<?php

class LoginController extends Controller
{


    public function actionIndex(){
        $this->layout=false;
        if($_POST){
            if(User::model()->user_login()){
                //$this->redirectStay('/Admin','登录成功');
                $this->redirect('/Admin/index?');
            }else{
                $error='用户名或密码错误';
            }
        }
        $this->render('login/login',array('error'=>$error));
        //$this->redirect('Product');
    }

    public function actionUserOut(){
        setcookie('username','',-1,'/');
        setcookie('password','',-1,'/');
        $this->redirect('index');
    }





}